package cn.jsj.dispose;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 查看律师业绩处理类
 * @author LI
 *
 */
 public class LawyerPerformanceLook extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
	 public void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		 // 调试信息
		 cn.jsj.utils.SysLogger.PrintInfo("查看律师业绩！！！");

		 //新建参数类
		 cn.jsj.bgtodb.LawyerPerformanceProperty lpp=new cn.jsj.bgtodb.LawyerPerformanceProperty();
		 lpp.setLpendTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("lpendTime").trim()));
		 lpp.setLpstartTime(cn.jsj.utils.TimeDispose.transferDate(request.getParameter("lpstartTime").trim()));
		 lpp.setLpLawyerId(Integer.parseInt(request.getParameter("lpLawyerId")));

		 //调试信息
		  cn.jsj.utils.SysLogger.PrintInfo("canshu------->"+lpp.getLpLawyerId());

		//输出到客户端
		java.io.PrintWriter out=response.getWriter();

	    //判断用户权限
		javax.servlet.http.HttpSession session=request.getSession();
		//如果为律师权限
		if((Integer)session.getAttribute("popedomLevel")==3){
			 //获取登陆用户ID
			 int userId=(Integer)session.getAttribute("userId");
			 // 如果要搜索的名字不同于律师自己的名字
			 if(userId!=lpp.getLpLawyerId()){
			 out.println("{message:'sorry'}");
			 out.flush();
			 out.close();
			 return;
		  }
		  }
		  //查看律师业绩
		  cn.jsj.dao.TblCaseInfoDAO tcid=new cn.jsj.dao.TblCaseInfoDAO();
		  String lawyerPerformance=tcid.lawyerPerformancelook(lpp);

		  out.println("{message:'"+lawyerPerformance+"'}");
		  out.flush();
		  out.close();
	}
}